@echo off

if not exist extracted\*.FTCX   call  wiso\eFont.bat

if not exist ..\extracted\font  mkdir ..\extracted\font
copy /Y  extracted\0218.FTCX   ..\extracted\font\0218.FTCX   >NUL


if not exist extdec\*.g*        call  wiso\eGraphic.bat

if not exist ..\extracted\ghelp mkdir ..\extracted\ghelp
FOR %%i IN (extdec\*.gwh) DO ffxgwh -e  %%i  ..\extracted\ghelp\%%~ni.bmp


if not exist ..\extracted\graphic mkdir ..\extracted\graphic
if exist extracted\0225.gnop   ffxgnop -e1        extracted\0225.gnop  extracted\0223.mpal  ..\extracted\graphic\0225.bmp
if exist extracted\0226.gnop   ffxgnop -e0        extracted\0226.gnop  extracted\0223.mpal  ..\extracted\graphic\0226.bmp
if exist extracted\0230.gnop   ffxgnop -e13,7     extracted\0230.gnop  extracted\0223.mpal  ..\extracted\graphic\0230.bmp
if exist extracted\0229.gnop   ffxgnop -e13,0     extracted\0229.gnop  extracted\0223.mpal  ..\extracted\graphic\0229.bmp
if exist extracted\0229.gnop   ffxgnop -e13,11    extracted\0229.gnop  extracted\0223.mpal  ..\extracted\graphic\0229_miss.bmp
if exist extracted\0229.gnop   ffxgnop -e13,12    extracted\0229.gnop  extracted\0223.mpal  ..\extracted\graphic\0229_immune.bmp
if exist extracted\0229.gnop   ffxgnop -e13,13    extracted\0229.gnop  extracted\0223.mpal  ..\extracted\graphic\0229_overkill.bmp


rem extension may be pressent or missing
rem extracting 34th image from 0240
FOR %%i IN (extdec\0240*) DO ffxgnop -e -pb 128,128,8,0x9A1D0  -pp 0x5920    %%i  %%i  ..\extracted\graphic\%%~ni.bmp

FOR %%i IN (extdec\2986*) DO (
    ffxgnop  -e -ta -pb 256,128,8,0x25F00  -pp 0x242E0    %%i  %%i  ..\extracted\graphic\%%~ni_0.bmp
    ffxgnop  -e -ta -pb 256,128,8,0x2DF00  -pp 0x246E0    %%i  %%i  ..\extracted\graphic\%%~ni_1.bmp
    ffxgnop  -e -ta -pb 256,128,8,0x35F00  -pp 0x24AE0    %%i  %%i  ..\extracted\graphic\%%~ni_2.bmp
    ffxgnop  -e -ta -pb 256,128,8,0x3DF00  -pp 0x24EE0    %%i  %%i  ..\extracted\graphic\%%~ni_3.bmp
    ffxgnop  -e -ta -pb 256,128,8,0x45F00  -pp 0x252E0    %%i  %%i  ..\extracted\graphic\%%~ni_4.bmp
    ffxgnop  -e -ta -pb 256,128,8,0x4DF00  -pp 0x256E0    %%i  %%i  ..\extracted\graphic\%%~ni_5.bmp
    ffxgnop  -e -ta -pb 256,64,8,0x55F00   -pp 0x25AE0    %%i  %%i  ..\extracted\graphic\%%~ni_6.bmp
)


if exist extdec\0175.gp   ffxgnop  -e -pb 512,512,8,0x420   -pp 0x20     extdec\0175.gp  extdec\0175.gp  ..\extracted\graphic\0175.bmp
if exist extdec\0181.gp   ffxgnop  -e -pb 512,512,8,0x420   -pp 0x20     extdec\0181.gp  extdec\0181.gp  ..\extracted\graphic\0181.bmp
if exist extdec\0178.gp (
    ffxgnop  -e -pb 512,512,8,0x450   -pp 0x50     extdec\0178.gp  extdec\0178.gp  ..\extracted\graphic\0178_0.bmp
    ffxgnop  -e -pb 512,512,8,0x40850 -pp 0x40450  extdec\0178.gp  extdec\0178.gp  ..\extracted\graphic\0178_1.bmp
    ffxgnop  -e -pb 256,256,8,0x80C50 -pp 0x80850  extdec\0178.gp  extdec\0178.gp  ..\extracted\graphic\0178_2.bmp
    ffxgnop  -e -pb 256,256,8,0x91050 -pp 0x90C50  extdec\0178.gp  extdec\0178.gp  ..\extracted\graphic\0178_3.bmp
)


rem if exist extdec\3738.map  ffxgnop  -e -pb 512,448,8,0x72D10  -pp 0xAAD50   extdec\3738.map  extdec\3738.map  ..\extracted\graphic\3738.bmp
rem if exist extdec\3740.map  ffxgnop  -e -pb 512,448,8,0x1B0    -pp 0x381F0   extdec\3740.map  extdec\3740.map  ..\extracted\graphic\3740.bmp
if exist extdec\3738.map  ffxmap -e3  extdec\3738.map  ..\extracted\graphic\3738.bmp
if exist extdec\3740.map  ffxmap -e0  extdec\3740.map  ..\extracted\graphic\3740.bmp


if not exist ..\extracted\gworld mkdir ..\extracted\gworld
if exist extdec\3650.map (
    rem extract ranges, so no need delete duplicities
    ffxmap  -e  -r 0-6     extdec\3650.map   ..\extracted\gworld\3650_
    ffxmap  -e  -r 10-11   extdec\3650.map   ..\extracted\gworld\3650_
    ffxmap  -e  -r 29-30   extdec\3650.map   ..\extracted\gworld\3650_
)


if not exist extdec\*.ev   call  wiso\eEV.bat

rem blitzball/misc graphic (not extracting duplicit)
ffxgnop  -e -ta    -pb 256,128,8,0x4719A0  -pp 0x4799A0,16,16,0,1   extdec\0348.ev  extdec\0348.ev  ..\extracted\graphic\0348.bmp
ffxgnop  -e -ta    -pb 256,256,8,0x5A20    -pp 0x15A20,16,16,0,1    extdec\0547.ev  extdec\0547.ev  ..\extracted\graphic\0547.bmp
ffxgnop  -e -ta    -pb 256,128,8,0xD5EA0   -pp 0xDDEA0,16,16,0,1    extdec\0739.ev  extdec\0739.ev  ..\extracted\graphic\0739.bmp
ffxgnop  -e        -pb 256,128,8,0x107A0   -pp 0x187A0,16,16        extdec\0830.ev  extdec\0830.ev  ..\extracted\graphic\0830.bmp

